package com.cet.designapplication.deprecated.state;

import com.cet.designapplication.deprecated.DeprecatedConstants;
import com.cet.designapplication.deprecated.observer.DeprecatedAbstractObserver;

import java.util.List;
import java.util.Vector;

/**
 * @author NSOC
 */
public class DeprecatedAbstractOrderState {

    protected final String ORDER_WAIT_PAY = "ORDER_WAIT_PAY";

    protected final String ORDER_WAIT_SEND = "ORDER_WAIT_SEND";

    protected final String ORDER_WAIT_RECEIVE = "ORDER_WAIT_RECEIVE";

    protected final String ORDER_FINISHED = "ORDER_FINISHED";

    protected final List<DeprecatedAbstractObserver> observerList = DeprecatedConstants.OBSERVER_LIST;

    public void addObserver(DeprecatedAbstractObserver observer) {
        this.observerList.add(observer);
    }

    public void removeObserver(DeprecatedAbstractObserver observer) {
        this.observerList.remove(observer);
    }

    public void notifyObservers(String orderId, String orderState) {
        for (DeprecatedAbstractObserver observer : observerList) {
            observer.orderStateHandle(orderId, orderState);
        }
    }

    protected DeprecatedOrder createOrder(String orderId, String productId, DeprecateOrderContext context) {
        throw new UnsupportedOperationException();
    }

    protected DeprecatedOrder payOrder(String orderId, DeprecateOrderContext context) {
        throw new UnsupportedOperationException();
    }

    protected DeprecatedOrder sendOrder(String orderId, DeprecateOrderContext context) {
        throw new UnsupportedOperationException();
    }

    protected DeprecatedOrder receiveOrder(String orderId, DeprecateOrderContext context) {
        throw new UnsupportedOperationException();
    }

}
